package com.sim.storage.enums

enum class LastApprovedTransactionFunctionCode(val code: String, val description: String) {
    CODE_30("30", "NETS Purchase"),
    CODE_17("17", "Cash Deposit"),
    CODE_27("27", "NETS Refund"),
    CODE_13("13", "NETS Void"),
    CODE_24("24", "NFP Debit"),
    CODE_46("46", "NFP Top up"),
    CODE_51("51", "NCC Purchase"),
    CODE_52("52", "NCC Purchase w/ Prev Balance"),
    CODE_45("45", "NCC Top up"),
    CODE_31("31", "UPI Purchase"),
    CODE_32("32", "UPI Purchase w/ Masked Pan"),
    CODE_91("91", "UPI Void"),
    CODE_99("99", "UPI Refund"),
    CODE_65("65", "BCA Purchase"),
    CODE_68("68", "BCA Void"),
    CODE_10("10", "Credit Card Sale"),
    CODE_11("11", "Credit Card Void"),
    CODE_14("14", "Credit Card Refund"),
    CODE_26("26", "CEPAS Debit"),
    CODE_47("47", "CEPAS Topup"),
    CODE_3B("3B", "NPC Top up"),
    CODE_00("00", "Single Entry API");

    companion object {
        fun fromCode(code: String): LastApprovedTransactionFunctionCode {
            return LastApprovedTransactionFunctionCode.values().find { it.code == code }
                ?: throw IllegalArgumentException("Unknown code: $code")
        }
    }
}